package com.cuckoo.mall.thus.menuindex.list;

import android.content.Context;

import com.bgn.baseframe.base.BasePresenterImpl;
import com.bgn.baseframe.network.HttpObserver;
import com.bgn.baseframe.network.bean.TDataBean;
import com.cuckoo.mall.javabean.Goods;
import com.cuckoo.mall.javabean.Product;
import com.cuckoo.mall.network.ApiManager;

import java.util.List;


/**
 * MVPPlugin
 * 邮箱 784787081@qq.com
 */

public class ListPresenter extends BasePresenterImpl<ListContract.View> implements ListContract.Presenter {

    @Override
    public void loadProductListById(final int type, int categoty_id, int page_index, int page_count) {

        ApiManager.getProductList(categoty_id, page_index, page_count).subscribe(new HttpObserver<TDataBean<List<Product>>>(mView) {
            @Override
            public void onSucceed(TDataBean<List<Product>> value) {
                if (value.getData() != null) {
                    mView.whenGetDataBack(type, value.getData());
                }
            }

            @Override
            public void onError(Throwable e) {
                super.onError(e);
            }
        });
    }
}
